import { ObjectOnlyPushSet } from '../../../../components/aaanewApp/global/global';

let mainSettleInfo = {
  data: ['tasksName', 'sign_obj', 'get_task'],
  tasksName: [],
  sign_obj: sign_obj,
  get_task: get_task,
};

let tasksName = 'tasksName';

function sign_obj(name, obj) {
  ObjectOnlyPushSet(this, name, obj, tasksName);
}

/**
 *
 * @param {string} str task 的 名称
 * @returns 对应的 task | main avanda 摘录
 */
function get_task(str) {
  if (str == 'all') {
    return excerpt_main_avadanda(this);
  }
  return this[str];
}

/**
 * 摘录
 * -
 *  mian 的 所有 taskname 信息集
 *
 * @param {object} main_that main avanda
 * @returns
 */
function excerpt_main_avadanda(main_that) {
  let b = { tasksName: [] };
  for (let i = 0; i < main_that[tasksName].length; i++) {
    ObjectOnlyPushSet(
      b,
      main_that[tasksName][i],
      main_that[main_that[tasksName][i]],
      tasksName
    );
  }
  return b;
}
let a = { name: 'main', settleInfo: mainSettleInfo };
export { a as main };
